package com.core.MQ;

import com.core.service.email.NotificationService;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import java.util.Map;

@Component
@Profile("mq-rabbit") // 关键
@RequiredArgsConstructor
public class RabbitMQConsumer {

    private final NotificationService notificationService;

    @RabbitListener(queues = "email.queue")
    public void handleReservationSuccess(Map<String, Object> payload) {
        notificationService.processReservationSuccessNotification(payload);
    }
}